import {get,post} from './axios'

export const HttpRequest = {
    sendEmailCode : (email:string)=>get(`galuser/user/sendMsg/${email}`),

    registerUser : (name:string,email:string,code:string,password:string)=>post('galuser/register/bymail',{name,email,code,password}),

    userLogin : (email:string,password:string)=>post('galuser/login/bypasswd',{email,password}),

    getUserInfo : (uid:number)=>get(`galuser/user/getInfo/${uid}`),

    saveUserInfo : (uid:number,name:string,gender:string,birthday:Date,message:string)=>post('galuser/user/setInfo',{uid,name,gender,birthday,message}),

    attchAvatar : (avatar:string)=>`http://localhost:9999/galuser/user/avatar/${avatar}`,

    getGameList : (offset:number)=>get(`galgame/game/sort/${offset}`),
    
    getSampleList : ()=>get('galsearch/games/sample'),

    getAllGames : ()=>get('galgame/game/all'),

    attchFirstPic : (uid:number)=>`http://localhost:9999/galgame/game/firstPic/${uid}`,

    getGameDetail : (gid:any)=>get(`/galgame/game/show/${gid}`),

    attchFile : (gid:number,fileName:string)=>`http://localhost:9999/galgame/game/resource?gid=${gid}&&fileName=${fileName}`,

    sendDanmu : (vid:number,uid:number,content:string,time:number)=>post('galserver/danmu/insert',{vid,uid,content,time}),

    getVideoDanmu : (gid:number,name:string)=>get(`galserver/danmu/videoDanmu?gid=${gid}&&name=${name}`),

    getCommentList : (gid:number)=>get(`galserver/comment/mps?gid=${gid}`),

    putComment : (uid:number,content:string,gid:number)=>post('galserver/comment/addMp',{uid,content,gid}),

    searchGame : (name:string,label:string)=>post('galsearch/games/search',{name,label}),
    
    deleteComment : (tid:number)=>get('galserver/comment/deleteMp',{tid}),
}